import { createRouter, createWebHistory } from 'vue-router'

import { Operation, Cellphone, Cpu, Location, Link } from "@element-plus/icons-vue";

const defaultRoutes = [
  {
    path: '/home',
    name: 'Home',
    meta: {
      title: '首页',
      icon: Location
    },
    component: () => import('../views/Home/Index.vue')
  },
  {
    path: '/device',
    name: 'Device',
    meta: {
      title: '设备列表',
      icon: Operation
    },
    component: () => import('../views/Device/Index.vue')
  },
  {
    path: '/client',
    name: 'Client',
    meta: {
      title: '客户端配置',
      icon: Cellphone,
    },
    component: () => import('../views/client/Index.vue')
  },
  {
    path: '/interface',
    name: 'Interface',
    meta: {
      title: '北向接口',
      icon: Cpu
    },
    component: () => import('../views/Interface/Index.vue')
  },
  {
    path: '/network',
    name: 'Network',
    meta: {
      title: '网络设置',
      icon: Link
    },
    component: () => import('../views/Network/Index.vue')
  },
]

const routes = [
  {
    path: '/',
    name: 'root',
    redirect: '/home',
    meta: {
      hidden: true
    },
    children: defaultRoutes,
    component: () => import('../layout/Index.vue'),
  },
  {
    path: '/:path(.*)*',
    name: 'notFound',
    meta: {
      hidden: true
    },
    component: () => import('../views/Exception/404.vue')
  }
]


const router = createRouter({
  history: createWebHistory(),
  routes:  routes
})

export {
  router,
  defaultRoutes,
}
